package com.training.java.core.collections.post15;

import java.util.HashSet;
import java.util.Set;

/**
 * This demo is HashSet type. HashSet is the simple and basic type of Set
 * implementation HashSet doesn't maintain the same order we added No duplicates
 * accepted
 * 
 * 
 * 
 * @author soumya
 * 
 */
public class CellPhoneHashSetDemo {

	public static void main(String[] args) {
		CellPhone phone1 = new CellPhone("Apple", "iPhone4s", "iOS6", 256);
		CellPhone phone2 = new CellPhone("Samsung", "Nexus5", "Android OS", 396);
		CellPhone phone3 = new CellPhone("Sony", "Xperia", "Android OS", 256);
		CellPhone phone4 = new CellPhone("Apple", "iPhone4s", "iOS6", 256);
		CellPhone phone5 = new CellPhone("Apple", "iPhone4s", "iOS6", 256);
		CellPhone phone6 = new CellPhone("Apple", "iPhone4s", "iOS6", 256);

		Set<CellPhone> cellPhones = new HashSet<CellPhone>();

		cellPhones.add(phone1);
		cellPhones.add(phone2);
		cellPhones.add(phone3);
		cellPhones.add(phone4);
		cellPhones.add(phone5);
		cellPhones.add(phone6);

		for (CellPhone phones : cellPhones) {

			System.out.println(" Cell Phone  Company : " + phones.getCompany());
			System.out.println(" Cell Phone  Model : " + phones.getModel());
			System.out.println(" Cell Phone operatingSystem : "
					+ phones.getOperatingSystem());
			System.out.println(" Cell Phone Price  : " + phones.getPrice());
			System.out.println("  ");

		}

	}

}
